package demoMod.invincibleOne.relics;

import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import demoMod.invincibleOne.InvincibleOneMod;

public class TheInvinciblesLament extends AbstractInvincibleRelic {
    public static final String ID = InvincibleOneMod.makeID("TheInvinciblesLament");
    public static final Texture IMG = new Texture(InvincibleOneMod.getResourcePath("relics/TheInvinciblesLament.png"));
    public static final Texture OUTLINE_IMG = new Texture(InvincibleOneMod.getResourcePath("relics/TheInvinciblesLament.png"));

    public TheInvinciblesLament() {
        super(ID, IMG, OUTLINE_IMG, RelicTier.SPECIAL, LandingSound.FLAT);
        this.counter = 1;
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }


    @Override
    public void atTurnStart() {
        if (TaskGoal.combatTurn == 1 && counter > 0) {
            this.flash();
            this.counter--;
            addToBot(new AbstractGameAction() {
                @Override
                public void update() {
                    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
                        if (!m.isDeadOrEscaped()) {
                            m.currentHealth = 1;
                            m.healthBarUpdatedEvent();
                        }
                    }
                    isDone = true;
                }
            });
        }
    }
}
